In [1]:
%pylab inline
matplotlib.rcParams['figure.figsize'] = (10,8)
In [2]:
from cno import cnodata, CNORbool
In [3]:
c = CNORbool(cnodata("PKN-ToyMMB.sif"), cnodata("MD-ToyMMB.csv"))
#c = CNORbool(cnodata("PKN-ExtLiverPCB.sif"),
# cnodata("MD-ExtLiverPCB.csv"))
#c = CNORbool(cnodata("PKN-LiverDREAM.sif"),
# cnodata("MD-LiverDREAM.csv"))
In [4]:
c.cnograph.png
Out[4]:
Done with a Genetic Algorithm
In [5]:
# the default exammple takes about 5-10 seconds
c.optimise()
In [6]:
c.results.results.keys()
Out[6]:
In the Genetic Algorithm, we have actually a set of models stored as well as the best model
In [7]:
c.results.results['best_bitstring'],c.results.results.reactions
Out[7]:
In [8]:
c.models.scores.min()
Out[8]:
In [9]:
c.models.df.ix[0:2]
Out[9]:
In [10]:
c.models.cnograph.midas = c.midas # could be done automatically in the code
c.models.cnograph.png
Out[10]:
In [11]:
c.models.errorbar()
In [12]:
c.models.heatmap()
Out[12]:
In [13]:
# a new page should be openned automatically in a few seconds
c.onweb()
In [14]:
c.simulate(c.results.results.best_bitstring)
Out[14]:
This function, which is actually a method could be used to solve the problem with any optimisation package.
In [15]:
def objfunc(parameters):
return c.simulate(parameters)
objfunc([0,0,0,0, 0,0,0,0, 0,1,1,1, 1,1,1,1])
Out[15]:
In [ ]: